Implement UInt64 on top of Int64Native with unsigned ops routed through native layer#12834
Merged
Simn merged 3 commits intohaxe-numericfrom Mar 17, 2026
Merged
Implement UInt64 on top of Int64Native with unsigned ops routed through native layer#12834Simn merged 3 commits intohaxe-numericfrom
Simn merged 3 commits intohaxe-numericfrom
Conversation
Co-authored-by: Simn <634365+Simn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Unify numeric types API across all targets
Implement UInt64 on top of Int64Native to validate shared signed/unsigned backing
Mar 17, 2026
Simn
requested changes
Mar 17, 2026
Member
Simn
left a comment
There was a problem hiding this comment.
Please also compare the Int64 vs. UInt64 public interfaces and let me know the differences.
…ent style Co-authored-by: Simn <634365+Simn@users.noreply.github.com>
Contributor
Author
Here's the Int64 vs UInt64 public API comparison: Only in Int64 (not in UInt64):
Only in UInt64 (not in Int64):
Same method, different semantics:
Identical in both: Possible gaps to discuss:
|
Copilot
AI
changed the title
Implement UInt64 on top of Int64Native to validate shared signed/unsigned backing
Implement UInt64 on top of Int64Native with unsigned ops routed through native layer
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explores whether unsigned 64-bit integers can reuse the same per-target
Int64Nativeimplementation as signedInt64, avoiding native code duplication. Answer: yes, with minimal complications.Design
haxe.UInt64—abstract UInt64(Int64Native)wrapping the same backing type asInt64Int64NativeInt64Nativeitself (udivMod,utoString,uparseString,ufromFloat,utoFloat) on all targets, so native targets can provide optimized implementations in the future. The portable algorithms live inhaxe.numeric.UInt64Helperand are used as the default implementation.Int64Native.ucompare;>>maps to existingInt64Native.ushrtoString()(no redundanttoStrstatic method)Key unsigned behaviors
Int64 vs UInt64 public interface comparison
Only in Int64:
isNeg,ucompare,toStr,isInt64,getHigh/getLow(deprecated),is(deprecated)Only in UInt64:
toFloat,fromInt64,toInt64Same method, different semantics:
compare(signed vs unsigned),toInt(throws vs truncates),toString(signed vs unsigned decimal),parseString/fromFloat(signed vs unsigned range),divMod/div/mod(signed vs unsigned division),shr(>>) (arithmetic vs logical shift)Identical in both:
copy,make,ofInt,isZero,add,sub,mul,eq,neq,and,or,xor,shl,ushr,neg,high/lowpropertiesFiles changed
std/haxe/UInt64.hx— public abstract with operator overloads, all ops route throughInt64Nativestd/haxe/numeric/UInt64Helper.hx— portable unsigned algorithms (division, toString, parsing, float conversion)std/haxe/numeric/Int64Native.hx— addedudivMod,utoString,uparseString,ufromFloat,utoFloatstd/jvm/_std/haxe/numeric/Int64Native.hx— added unsigned method signatures (delegates to UInt64Helper)std/hl/_std/haxe/numeric/Int64Native.hx— added unsigned method signatures (delegates to UInt64Helper)std/cpp/_std/haxe/numeric/Int64Native.hx— added unsigned method signatures with CPPIA declarationsstd/eval/_std/haxe/numeric/Int64Native.hx— added unsigned method signatures (delegates to UInt64Helper)tests/unit/src/unit/TestUInt64.hx— covers construction, unsigned comparison/division/shifts, Int64 round-trips, parsing, edge casesAll unit tests pass on Interp, JS, JVM, Python, Neko, PHP.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.